import request from "@/utils/request";

const GRADEINFO_BASE_URL = "/wz/wang/grade_info";

class GradeInfoAPI {
  /** 获取年级信息表分页数据 */
  static getPage(queryParams?: GradeInfoPageQuery) {
    return request<any, PageResult<GradeInfoPageVO[]>>({
      url: `${GRADEINFO_BASE_URL}/page`,
      method: "get",
      params: queryParams,
    });
  }

  /** 获取年级信息表列表数据 */
  static getList(queryParams?: GradeInfoPageQuery) {
    return request<any, GradeInfoPageVO[]>({
      url: `${GRADEINFO_BASE_URL}/list`,
      method: "get",
      params: queryParams,
    });
  }

  /**
   * 获取年级信息表表单数据
   *
   * @param id GradeInfoID
   * @returns GradeInfo表单数据
   */
  static getFormData(id: number) {
    return request<any, GradeInfoForm>({
      url: `${GRADEINFO_BASE_URL}/detail?id=` + id,
      method: "get",
    });
  }

  /** 添加年级信息表*/
  static add(data: GradeInfoForm) {
    return request({
      url: `${GRADEINFO_BASE_URL}/save`,
      method: "post",
      data: data,
    });
  }

  /**
   * 更新年级信息表
   *
   * @param id GradeInfoID
   * @param data GradeInfo表单数据
   */
  static update(data: GradeInfoForm) {
    return request({
      url: `${GRADEINFO_BASE_URL}/update`,
      method: "put",
      data: data,
    });
  }

  /**
   * 批量删除年级信息表，多个以英文逗号(,)分割
   *
   * @param ids 年级信息表ID字符串，多个以英文逗号(,)分割
   */
  static deleteByIds(ids: string) {
    return request({
      url: `${GRADEINFO_BASE_URL}/remove?ids=` + ids,
      method: "delete",
    });
  }
}

export default GradeInfoAPI;

/** 年级信息表分页查询参数 */
export interface GradeInfoPageQuery extends PageQuery {
  name?: string;
  /** 所属阶段 */
  school_type?: number;
}

/** 年级信息表表单对象 */
export interface GradeInfoForm {
  id?: number;
  name?: string;
  create_date?: string;
  update_date?: string;
  /** 所属阶段 */
  school_type?: number;
}

/** 年级信息表分页对象 */
export interface GradeInfoPageVO {
  id?: number;
  name?: string;
  create_date?: string;
  /** 所属阶段 */
  school_type?: number;
}
